
package sk.lieskove.jianghongtiao.aresapi.response.obj;

import java.io.Serializable;
import java.security.InvalidParameterException;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToOne;
import javax.persistence.Table;

/**
 * Chybová odpověď v elementu Fault
 * 
 * <p>Java class for chybova_odpoved complex type.
 * 
 * <p>The following schema fragment specifies the expected content contained within this class.
 * 
 * <pre>
 * &lt;complexType name="chybova_odpoved">
 *   &lt;complexContent>
 *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       &lt;sequence>
 *         &lt;element name="faultcode" type="{http://wwwinfo.mfcr.cz/ares/xml_doc/schemas/uvis_datatypes/v_1.0.1}popis" minOccurs="0"/>
 *         &lt;element name="faultstring" type="{http://wwwinfo.mfcr.cz/ares/xml_doc/schemas/uvis_datatypes/v_1.0.1}popis" minOccurs="0"/>
 *       &lt;/sequence>
 *     &lt;/restriction>
 *   &lt;/complexContent>
 * &lt;/complexType>
 * </pre>
 * 
 * 
 */
@Entity
@Table(name="ares_chybova_odpoved")
public class ChybovaOdpoved implements Serializable{

    @Id
    @GeneratedValue
    private Long Id;
    protected String faultcode;
    protected String faultstring;
    @OneToOne(mappedBy = "fault", cascade=CascadeType.PERSIST, fetch=FetchType.EAGER)
    private AresOdpovedi aresOdpovedi;

    public ChybovaOdpoved() {
    }

    public ChybovaOdpoved(String faultcode, String faultstring) {
        if((faultcode == null) || (faultcode.equals(""))){
            throw new InvalidParameterException("'faultcode' is null or empty.");
        }
        if((faultstring == null) || (faultstring.equals(""))){
            throw new InvalidParameterException("'faultstring' is null or empty.");
        }

        this.faultcode = faultcode;
        this.faultstring = faultstring;
    }

    public Long getId() {
        return Id;
    }

    public void setId(Long Id) {
        this.Id = Id;
    }

    public AresOdpovedi getAresOdpovedi() {
        return aresOdpovedi;
    }

    public void setAresOdpovedi(AresOdpovedi aresOdpovedi) {
        this.aresOdpovedi = aresOdpovedi;
    }


    /**
     * Gets the value of the faultcode property.
     * 
     * @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getFaultcode() {
        return faultcode;
    }

    /**
     * Sets the value of the faultcode property.
     * 
     * @param value
     *     allowed object is
     *     {@link String }
     *     
     */
    public void setFaultcode(String value) {
        this.faultcode = value;
    }

    /**
     * Gets the value of the faultstring property.
     * 
     * @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getFaultstring() {
        return faultstring;
    }

    /**
     * Sets the value of the faultstring property.
     * 
     * @param value
     *     allowed object is
     *     {@link String }
     *     
     */
    public void setFaultstring(String value) {
        this.faultstring = value;
    }

}
